<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">

    <title>电力巡检系统</title>
    <!-- plugins:css -->
    <link rel="stylesheet" href="vendors/iconfonts/mdi/css/materialdesignicons.min.css">
    <link rel="stylesheet" href="vendors/css/vendor.bundle.base.css">
    <link rel="stylesheet" href="css/style.css">
    <!-- endinject -->
    <link rel="shortcut icon" href="images/favicon.png" />
    <%@include file="common.jsp"%>
    <style>
        body{
            background-color: #f2edf3;
        }
        .main-panel{
            margin-left: 20px;
            margin-top: 20px;
            overflow: hidden;
        }
    </style>
    <script>
        layui.use('layer');
        function logout() {
            layer.confirm('确定要退出?',{icon:3,title:'系统提示'},function (index) {
                location.href = "elepower/logout";
            });
        }
    </script>
</head>
<body>
<div class="container-scroller">
    <!-- partial:partials/_navbar.html -->
    <nav class="navbar default-layout-navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
        <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
            <a class="navbar-brand brand-logo" href="index.html">电力巡检系统</a>
            <a class="navbar-brand brand-logo-mini" href="index.html"></a>
        </div>
        <div class="navbar-menu-wrapper d-flex align-items-stretch">
            <ul class="navbar-nav navbar-nav-right">
                <li class="nav-item nav-profile dropdown">
                    <a class="nav-link dropdown-toggle" id="profileDropdown" href="#" data-toggle="dropdown" aria-expanded="false">
                        <div class="nav-profile-img">
                            <img src="images/faces/face1.jpg" alt="image">
                            <span class="availability-status online"></span>
                        </div>
                        <div class="nav-profile-text">
                            <p class="mb-1 text-black">${sessionScope.login_user.name}</p>
                        </div>
                    </a>
                    <div class="dropdown-menu navbar-dropdown" aria-labelledby="profileDropdown">
                        <a class="dropdown-item" href="/self/update" target="middle">
                            个人资料修改
                        </a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="javascript:void(0)" onclick="logout()">
                            <i class="mdi mdi-logout mr-2 text-primary"></i>
                            Signout
                        </a>
                    </div>
                </li>
                <li class="nav-item nav-logout d-none d-lg-block">
                    <a class="nav-link" href="javascript:void(0)" onclick="logout()">
                        <i class="mdi mdi-power"></i>
                    </a>
                </li>
            </ul>
            <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
                <span class="mdi mdi-menu"></span>
            </button>
        </div>
    </nav>
    <!-- partial -->
    <div class="container-fluid page-body-wrapper">
        <!-- partial:partials/_sidebar.html -->
        <nav class="sidebar sidebar-offcanvas" id="sidebar">
            <ul class="nav">
                <li class="nav-item nav-profile">
                    <a href="#" class="nav-link">
                        <div class="nav-profile-image">
                            <img src="images/faces/face1.jpg" alt="profile">
                            <span class="login-status online"></span> <!--change to offline or busy as needed-->
                        </div>
                        <div class="nav-profile-text d-flex flex-column">
                            <span class="font-weight-bold mb-2">${sessionScope.login_user.name}</span>
                            <span class="text-secondary text-small">${sessionScope.login_user.username}</span>
                        </div>
                        <i class="mdi mdi-bookmark-check text-success nav-profile-badge"></i>
                    </a>
                </li>
                <c:forEach items="${sessionScope.user_pers}" var="parentPer">
                    <c:if test="${parentPer.parentId == null and parentPer.funUrl == null and parentPer.isStart == 1}">
                        <li class="nav-item">
                            <a class="nav-link" data-toggle="collapse" href="#ui-basic${parentPer.id}" aria-expanded="false" aria-controls="ui-basic">
                                <span class="menu-title">${parentPer.functionName}</span>
                                <i class="menu-arrow"></i>
                                <i class="mdi mdi-crosshairs-gps menu-icon"></i>
                            </a>
                            <div class="collapse" id="ui-basic${parentPer.id}">
                                <ul class="nav flex-column sub-menu">
                                    <c:forEach items="${sessionScope.user_pers}" var="per">
                                        <c:if test="${per.parentId != null and per.parentId == parentPer.id and per.isStart == 1}">
                                            <li class="nav-item"> <a class="nav-link" href="${per.funUrl}" target="middle">${per.functionName}</a></li>
                                        </c:if>
                                    </c:forEach>
                                </ul>
                            </div>
                        </li>
                    </c:if>
                    <c:if test="${parentPer.parentId == null and parentPer.funUrl != null and parentPer.isStart == 1}">
                        <li class="nav-item">
                            <a class="nav-link" href="${parentPer.funUrl}" target="middle">
                                <span class="menu-title">${parentPer.functionName}</span>
                            </a>
                        </li>
                    </c:if>
                </c:forEach>
            </ul>
        </nav>

        <div class="main-panel">
            <iframe src="/self/update" frameborder="0" height="100%" width="100%" name="middle"></iframe>
        </div>

    </div>
</div>
<script>
    layui.use(["table","form","laydate"],function () {

    });
</script>
<script src="vendors/js/vendor.bundle.base.js"></script>
<script src="vendors/js/vendor.bundle.addons.js"></script>
<script src="js/off-canvas.js"></script>
<script src="js/misc.js"></script>
<script src="js/dashboard.js"></script>

</body>
</html>